.class public Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;
.super Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;
.source "BurstlyInterstitial.java"

# interfaces
.implements Lcom/burstly/lib/conveniencelayer/ICacheable;


# instance fields
.field private mAutoCached:Z

.field private mShowTriggered:Z


# direct methods
.method public constructor <init>(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;Z)V
    .locals 1
    .parameter "activity"
    .parameter "zoneId"
    .parameter "viewName"
    .parameter "autoCache"

    .prologue
    .line 67
    sget-object v0, Lcom/burstly/lib/conveniencelayer/BurstlyAdSize;->INTERSTITIAL:Lcom/burstly/lib/conveniencelayer/BurstlyAdSize;

    invoke-direct {p0, p1, v0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;-><init>(Landroid/app/Activity;Lcom/burstly/lib/conveniencelayer/BurstlyAdSize;)V

    .line 68
    iput-boolean p4, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mAutoCached:Z

    .line 69
    invoke-virtual {p0, p1, p2, p3}, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->initNewBurstlyInterstitial(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;)V

    .line 70
    return-void
.end method

.method public constructor <init>(Landroid/support/v4/app/Fragment;Ljava/lang/String;Ljava/lang/String;Z)V
    .locals 1
    .parameter "fragment"
    .parameter "zoneId"
    .parameter "viewName"
    .parameter "autoCache"

    .prologue
    .line 84
    sget-object v0, Lcom/burstly/lib/conveniencelayer/BurstlyAdSize;->INTERSTITIAL:Lcom/burstly/lib/conveniencelayer/BurstlyAdSize;

    invoke-direct {p0, p1, v0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;-><init>(Landroid/support/v4/app/Fragment;Lcom/burstly/lib/conveniencelayer/BurstlyAdSize;)V

    .line 85
    iput-boolean p4, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mAutoCached:Z

    .line 86
    invoke-virtual {p1}, Landroid/support/v4/app/Fragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v0

    invoke-virtual {p0, v0, p2, p3}, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->initNewBurstlyInterstitial(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;)V

    .line 87
    return-void
.end method


# virtual methods
.method public cacheAd()V
    .locals 3

    .prologue
    .line 172
    iget-boolean v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mAutoCached:Z

    if-eqz v0, :cond_0

    .line 173
    new-instance v0, Ljava/lang/RuntimeException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Automatic caching enabled for "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->getName()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ". Do not attempt to manually cache an ad also"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 177
    :cond_0
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->baseCacheAd()V

    .line 178
    return-void
.end method

.method public hasCachedAd()Z
    .locals 1

    .prologue
    .line 187
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->baseHasCachedAd()Z

    move-result v0

    return v0
.end method

.method initNewBurstlyInterstitial(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;)V
    .locals 2
    .parameter "activity"
    .parameter "zoneId"
    .parameter "viewName"

    .prologue
    .line 99
    new-instance v0, Lcom/burstly/lib/ui/BurstlyView;

    invoke-direct {v0, p1}, Lcom/burstly/lib/ui/BurstlyView;-><init>(Landroid/content/Context;)V

    .line 100
    .local v0, burstlyView:Lcom/burstly/lib/ui/BurstlyView;
    invoke-static {}, Lcom/burstly/lib/conveniencelayer/Burstly;->getAppID()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/burstly/lib/ui/BurstlyView;->setPublisherId(Ljava/lang/String;)V

    .line 101
    invoke-virtual {v0, p2}, Lcom/burstly/lib/ui/BurstlyView;->setZoneId(Ljava/lang/String;)V

    .line 102
    invoke-virtual {v0, p3}, Lcom/burstly/lib/ui/BurstlyView;->setBurstlyViewId(Ljava/lang/String;)V

    .line 103
    invoke-virtual {p0, v0}, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->setBurstlyView(Lcom/burstly/lib/ui/BurstlyView;)V

    .line 104
    iget-boolean v1, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mAutoCached:Z

    if-eqz v1, :cond_0

    .line 105
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->baseCacheAd()V

    .line 107
    :cond_0
    return-void
.end method

.method public isCachingAd()Z
    .locals 1

    .prologue
    .line 197
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->baseIsCachingAd()Z

    move-result v0

    return v0
.end method

.method protected onCache(Lcom/burstly/lib/conveniencelayer/events/AdCacheEvent;)V
    .locals 1
    .parameter "event"

    .prologue
    .line 238
    invoke-super {p0, p1}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->onCache(Lcom/burstly/lib/conveniencelayer/events/AdCacheEvent;)V

    .line 239
    iget-boolean v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mShowTriggered:Z

    if-eqz v0, :cond_0

    .line 240
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mShowTriggered:Z

    .line 241
    invoke-virtual {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->showAd()V

    .line 243
    :cond_0
    return-void
.end method

.method protected onDismissFullscreen(Lcom/burstly/lib/conveniencelayer/events/AdDismissFullscreenEvent;)V
    .locals 3
    .parameter "event"

    .prologue
    .line 263
    invoke-super {p0, p1}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->onDismissFullscreen(Lcom/burstly/lib/conveniencelayer/events/AdDismissFullscreenEvent;)V

    .line 264
    iget-boolean v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mAutoCached:Z

    if-eqz v0, :cond_0

    invoke-virtual {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->hasCachedAd()Z

    move-result v0

    if-nez v0, :cond_0

    .line 265
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->baseCacheAd()V

    .line 267
    :cond_0
    new-instance v0, Lcom/burstly/lib/conveniencelayer/events/AdHideEvent;

    const/4 v1, 0x0

    iget-object v2, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mLastShow:Lcom/burstly/lib/conveniencelayer/events/AdShowEvent;

    invoke-direct {v0, v1, v2}, Lcom/burstly/lib/conveniencelayer/events/AdHideEvent;-><init>(ZLcom/burstly/lib/conveniencelayer/events/AdShowEvent;)V

    invoke-virtual {p0, v0}, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->onHide(Lcom/burstly/lib/conveniencelayer/events/AdHideEvent;)V

    .line 268
    return-void
.end method

.method protected onFail(Lcom/burstly/lib/conveniencelayer/events/AdFailEvent;)V
    .locals 3
    .parameter "event"

    .prologue
    .line 219
    sget-object v2, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;->Idle:Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;

    iput-object v2, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mCachingState:Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;

    .line 220
    const/4 v2, 0x0

    iput-boolean v2, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mShowTriggered:Z

    .line 223
    iget-boolean v2, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mAutoCached:Z

    if-eqz v2, :cond_0

    invoke-virtual {p1}, Lcom/burstly/lib/conveniencelayer/events/AdFailEvent;->wasFailureResultOfCachingAttempt()Z

    move-result v2

    if-nez v2, :cond_1

    .line 224
    :cond_0
    iget-object v2, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mListeners:Ljava/util/List;

    invoke-interface {v2}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    .local v0, i$:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_1

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/burstly/lib/conveniencelayer/IBurstlyListener;

    .line 225
    .local v1, listener:Lcom/burstly/lib/conveniencelayer/IBurstlyListener;
    invoke-interface {v1, p0, p1}, Lcom/burstly/lib/conveniencelayer/IBurstlyListener;->onFail(Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;Lcom/burstly/lib/conveniencelayer/events/AdFailEvent;)V

    goto :goto_0

    .line 228
    .end local v0           #i$:Ljava/util/Iterator;
    .end local v1           #listener:Lcom/burstly/lib/conveniencelayer/IBurstlyListener;
    :cond_1
    return-void
.end method

.method protected resumed()V
    .locals 1

    .prologue
    .line 131
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->resumed()V

    .line 132
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mShowTriggered:Z

    .line 133
    iget-boolean v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mAutoCached:Z

    if-eqz v0, :cond_0

    invoke-virtual {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->hasCachedAd()Z

    move-result v0

    if-nez v0, :cond_0

    .line 134
    sget-object v0, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;->Retrieving:Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;

    iput-object v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mCachingState:Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;

    .line 135
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->baseCacheAd()V

    .line 137
    :cond_0
    return-void
.end method

.method public showAd()V
    .locals 2

    .prologue
    .line 148
    iget-boolean v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mAutoCached:Z

    if-eqz v0, :cond_2

    .line 149
    iget-object v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mCachingState:Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;

    sget-object v1, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;->Retrieving:Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;

    if-ne v0, v1, :cond_1

    .line 150
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mShowTriggered:Z

    .line 165
    :cond_0
    :goto_0
    return-void

    .line 151
    :cond_1
    iget-object v0, p0, Lcom/burstly/lib/conveniencelayer/BurstlyInterstitial;->mCachingState:Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;

    sget-object v1, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;->Retrieved:Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd$CachingState;

    if-ne v0, v1, :cond_0

    .line 152
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->showAd()V

    goto :goto_0

    .line 163
    :cond_2
    invoke-super {p0}, Lcom/burstly/lib/conveniencelayer/BurstlyBaseAd;->showAd()V

    goto :goto_0
.end method
